
function login() {
    // 获取输入的值
    const username = $('#username').val().trim();
    const password = $('#password').val().trim();

    // 用户名和密码不能为空
    if (username && password) {
        // 发送ajax请求
        request({
            type: "post",
            url: "/admin/user/login",
            data: { username, password },

            success: function (response) {
                // console.log(response);

                if (response.code === 200) {
                    window.localStorage.setItem('bignew_token', response.token)
                    window.location.href = "./index.html"

                } else {
                    // 弹出模态框
                    $('#loginModal').modal('show')
                    // 设置模态框文本内容
                    $('.modal-body').text(response.msg)

                }
            }
        });
    }

}



